package com.zqs.mapper;

import com.zqs.entity.Collect;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;
import org.springframework.stereotype.Repository;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestParam;

import java.awt.*;
import java.util.List;

@Repository
public interface CollectMapper {

    @Insert("insert into t_collect(uid,title,price,image,detail,state,created_user,created_time,modified_time,modified_user) " +
            "values(#{uid},#{title},#{price},#{image},#{detail},#{state},#{createdUser}," +
            "#{createdTime},#{modifiedTime},#{modifiedUser})")
    Integer addCollect(Collect collect);

    @Select("select * from t_collect where uid = #{uid}")
    List<Collect> getByUid(Integer uid);

    @Update("update t_collect set state = 0 where id = #{id} and uid = #{uid}")
    Integer updateStateById(@Param("id") Integer id, @Param("uid") Integer uid);
}
